<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <f:metadata>
        <f:viewParam name="text" value="#{searchView.searchText}">        </f:viewParam>
        <f:viewAction action="#{searchView.init}"/>
    </f:metadata>

    <h:head>
        <title>search results</title>
        <style>@import url("../resources/css/homepageCSS1.css")</style>
    </h:head>

    <h:body>
        <p:layout fullPage="true">

            <p:layoutUnit styleClass="topLayout" position="north" size="100" resizable="true">
                <img id="titleImg" src="../resources/images/titolo90.png" alt="METEOCAL"/>
                <div id="userBlock">
                    <h:form>
                        <p:outputLabel>
                            #{userBean.name}&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:commandLink style="color: blue;" value="Home" action="#{searchView.backHome()}"/>
                        <p:outputLabel>
                            &nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;
                        </p:outputLabel>
                        <p:commandLink style="color: blue;" action="#{loginBean.logout()}" value="Logout"/>
                    </h:form>
                </div>
                <div id="searchBar">
                    <h:form>
                        <p:inputText styleClass="inputTextStyleNoBorder" id="search" value="#{searchView.searchText}" required="true"/>
                        <p:commandButton value="" style="width: 32px; height: 32px; background: #000000 url(../resources/images/search_icon3.png) no-repeat top right" action = "#{userBean.search()}">
                            <f:param name="text" value="#{userBean.searchText}">
                            </f:param>
                        </p:commandButton>
                    </h:form>
                </div>
            </p:layoutUnit>

            <p:layoutUnit styleClass="centralBlock" position="center">
                <h:form id="resultsForm">
                    <p:dataList emptyMessage="No results found." paginatorAlwaysVisible="false" paginatorPosition="bottom" var="user" value="#{searchView.results}" type="unordered" itemType="none" paginator="true" rows="10" styleClass="paginated">
                        <f:facet name="header">
                            Results for #{searchView.searchText}:
                        </f:facet>
                        <div style="margin: 8px;">
                            <h:outputText value="#{user.firstName} #{user.lastName} (" style="display:inline-block" />
                            <h:link value="#{user.email}" outcome="#{userDataBean.redirectToUserPage(user.email)}">
                            </h:link>
                            <h:outputText value=")" style="display:inline-block" /> 
                        </div>
                    </p:dataList>
                </h:form>
            </p:layoutUnit>

        </p:layout>
    </h:body>
</html>

